'use strict';
module.exports = dc => {
  const sequelize = dc.orm;
  const DataTypes = dc.ORM;
  const PatentInfo = sequelize.define('PatentInfo', {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      autoIncrement: true,
      comment: '序号（手动输入）'
    },
    case_number: {
      type: DataTypes.STRING(50),
      comment: '我司案号'
    },
    patent_name: {
      type: DataTypes.TEXT,
      comment: '专利名称'
    },
    application_number: {
      type: DataTypes.STRING(50),
      comment: '专利申请号'
    },
    patent_type: {
      type: DataTypes.STRING(50),
      comment: '专利类型'
    },
    disclosure_collection_date: {
      type: DataTypes.DATEONLY,
      comment: '技术交底书收集时间'
    },
    acceptance_notice_date: {
      type: DataTypes.DATEONLY,
      comment: '受理发文'
    },
    grant_notice_date: {
      type: DataTypes.DATEONLY,
      comment: '授权发文'
    },
    certificate_issue_date: {
      type: DataTypes.DATEONLY,
      comment: '下证发文'
    },
    invalidation_date: {
      type: DataTypes.DATEONLY,
      comment: '无效日期'
    },
    agency_process_date: {
      type: DataTypes.DATEONLY,
      comment: '代理机构处理时间'
    },
    cnipa_process_date: {
      type: DataTypes.DATEONLY,
      comment: '国知局下证处理时间'
    },
    patent_status: {
      type: DataTypes.STRING(50),
      comment: '专利状态'
    },
    fast_track: {
      type: DataTypes.BOOLEAN,
      comment: '是否走快审通道'
    },
    patentee: {
      type: DataTypes.STRING(255),
      comment: '专利权人'
    },
    changed_patentee: {
      type: DataTypes.STRING(255),
      comment: '变更后专利权人'
    },
    change_procedure_date: {
      type: DataTypes.DATEONLY,
      comment: '变更手续合格日期'
    },
    inventors: {
      type: DataTypes.TEXT,
      comment: '发明人'
    },
    first_inventor: {
      type: DataTypes.STRING(100),
      comment: '第一发明人'
    },
    department: {
      type: DataTypes.STRING(100),
      comment: '来源部门'
    },
    related_product: {
      type: DataTypes.STRING(100),
      comment: '关联产品'
    },
    related_project: {
      type: DataTypes.STRING(100),
      comment: '关联立项/课题'
    },
    strategy_type: {
      type: DataTypes.STRING(20),
      comment: '防御型/攻击型'
    },
    is_core: {
      type: DataTypes.BOOLEAN,
      comment: '是否为核心'
    },
    core_score: {
      type: DataTypes.INTEGER,
      comment: '核心分数'
    },
    original_disclosure_name: {
      type: DataTypes.TEXT,
      comment: '原始交底书名称'
    },
    agency: {
      type: DataTypes.STRING(255),
      comment: '代理机构'
    },
    manager: {
      type: DataTypes.STRING(100),
      comment: '负责人'
    },
    agency_case_number: {
      type: DataTypes.STRING(50),
      comment: '代理案号'
    },
    special_notes: {
      type: DataTypes.TEXT,
      comment: '特殊事项备注'
    },
    related_development_project: {
      type: DataTypes.STRING(100),
      comment: '（发展部）关联课题/项目'
    }
  }, {
    tableName: 'patent_info',
    timestamps: false,
    indexes: [
      {
        unique: true,
        fields: ['patent_name', 'application_number'],
        name: 'unique_patent_name_application_number'
      }
    ]
  });

  dc.models.PatentInfo = PatentInfo;
  return PatentInfo;
}; 